package com.cn.lycss.service;

import com.cn.lycss.dao.NavDao;
import com.cn.lycss.dao.NewsDao;
import com.cn.lycss.model.NewsModel;

public class NewsService {

    public NewsModel[] getNewsModelForNewsPage() {
       NewsModel[] newsModels=new NewsModel[10];
        NewsDao newsDao=new NewsDao();
        for (int i = 0; i <newsModels.length ; i++) {
            NewsModel newsModel=new NewsModel();

            newsModel.setTitle(newsDao.titleForNewsPage[i]);
            newsModel.setContent(newsDao.contentFornewsPage[i]);
            newsModels[i]=newsModel;
        }
return  newsModels;
    }

    public NewsModel[] getNewsModelForHomePage() {
        NewsDao newsDao=new NewsDao();
        NewsModel[] newsModels=new NewsModel[3];
        for (int i = 0; i <newsModels.length ; i++) {
            NewsModel newsModel=new NewsModel();

            newsModel.setTitle(newsDao.titleForHomePage[i]);
            newsModel.setContent(newsDao.contentForHomePage[i]);
            newsModel.setImgHref(newsDao.imgHrefFornewsPage[i]);
            newsModel.setCreateTime(newsDao.createTimeFornewsPage[i]);
            newsModels[i]=newsModel;
        }
        return  newsModels;
    }
}
